<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>主页 | 米尔豪斯酒店网上订餐</title>
    <link rel="stylesheet" type="text/css" href="../css/tianpin_order.css">
    <script type="text/javascript">
        function tianpin_addcart(id) {
            window.location.href = "tianpin_addcart.php?id="+id;
        }
    </script>
</head>
<body>
<div class="all">
    <div class="all1">
        <div class="home">
            <div class="header">
                <div class="header1">
                    <div class="name">
                        <a href="index.php"><h1>米尔豪斯</h1></a>
                    </div>
                    <div class="guide">
                        <ul>
                            <li><a href="cart.php">购物车</a></li>
                            <li><a href="../register.html">注&nbsp;册</a></li>
                            <li><a href="../login.html">登&nbsp;陆</a></li>
                            <li><a href="zhongcan_order.php">点&nbsp;餐</a></li>
                            <li><a href="consult.php">留&nbsp;言</a></li>
                            <li><a href="index.php">主&nbsp;页</a></li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="header2">
                <div class="header3">
                    <h1>Order</h1>
                 </div>
            </div>

            <div class="bottom2">
                <img src="../img/border.png" alt="底线">
            </div>
        </div>

        <div class="middle">
            <div class="middle1">
                <ul>
                    <li><a href="index.php">主页</a></li>
                    <li class="middle3">/</li>
                    <li class="middle2">菜单</li>
                </ul>
            </div>
            <div class="bottom1">
                <img src="../img/border.png" alt="底线">
            </div>
        </div>
    </div>
<?php 
    session_start();
    header("Content-type:text/html;charset=utf-8"); 
 ?>
    <div class="all2">
        <h1>Menu</h1>
        <div class="menu">
            <div class="menu_guide">
                <ul>
                    <li><a href="zhongcan_order.php" ><img src="../img/中餐.png" >&nbsp;&nbsp;中餐</a></li>
                    <li><a href="xican_order.php"><img src="../img/西餐.png">&nbsp;&nbsp;西餐</a></li>
                    <li><a href="kuaican_order.php"><img src="../img/快餐.png">&nbsp;&nbsp;快餐</a></li>
                    <li><a href="tianpin_order.php" class="active"><img src="../img/甜品.png">&nbsp;&nbsp;甜品</a></li>
                    <li><a href="juice_order.php"><img src="../img/饮料.png">&nbsp;&nbsp;饮料</a></li>
                </ul>
            </div>
            <div class="order">
                <form action="tianpin_addcart.php" method="post">
        <?php
            $conn = 	$conn = mysqli_connect('127.0.0.1','root','pwd','admin',3306);//链接数据库('localhost','hotel','vw8jj2','shop',3308);
            mysqli_set_charset($conn,'utf8'); 
            $sql_select = "select id,title,price,num from tianpin ";
            $stmt=mysqli_query($conn,$sql_select);
         
            while($row=mysqli_fetch_assoc($stmt)){
        ?>
                <div class="food">
                    <ul>
                        <li>
                            <img src="../img/pro_img1.jpg">
                            <div class="card">
                                <h2><?php echo $row['title'] ?></h2>
                                <span><p><?php echo $row['price'] ?>￥&nbsp;&nbsp;<?php echo $row['num'] ?>份</p></span>

                                <a href="javascript:tianpin_addcart(<?php echo $row['id']?>)">加入购物车</a>
                            </div>
                        </li>
                    </ul>
                </div>

            <?php 
    }
         ?>
            </form>
            </div>         
        </div>
    </div>

    <div class="footer">
        <h1>欢迎来到米尔豪斯酒店订餐</h1>
    </div>

</div>
</body>
</html>